#pragma once

#include "stdafx.h"
//#include "MyCommon.h"

using namespace MyCommon;

typedef MyCommon::Vector3 MyVec3;
typedef MyCommon::Real MyReal;

class Wall3D
{
protected:
	MyVec3 mvA,mvB,mvNormal;
	MyReal mHeight;

	void CalcNormal()
	{
		MyVec3 tmp1 = (mvB-mvA).normalisedCopy();
		//MyVec3 tmp2 = (mvA-MyVec3::UNIT_Y).normalisedCopy();
		mvNormal = MyVec3::UNIT_Y.crossProduct(tmp1);
	}

public:
	Wall3D(void) {};
	Wall3D(MyVec3 a,MyVec3 b,MyReal height=1.0) : mvA(a),mvB(b),mHeight(height) 
	{
		CalcNormal();
	}

	Wall3D(MyVec3 a,MyVec3 b,MyVec3 n,MyReal height=1.0) 
		: mvA(a),mvB(b),mvNormal(n),mHeight(height) {}

	
	const MyVec3& From() const { return mvA; }
	void SetFrom(const MyVec3& a){	mvA=a; CalcNormal();	}

	const MyVec3& To() const {return mvB;}
	void SetTo(const MyVec3& b) {mvB=b; CalcNormal();	}

	const MyVec3& Normal() const { return mvNormal;}
	void SetNormal(const MyVec3& n) {mvNormal=n;}

	MyReal Height() const { return mHeight; }
	void SetHeight(const MyReal& height) { mHeight=height; }

	MyVec3 Center() const { return (mvA+mvB)*MyReal(0.5); }



};
